//
// Created by Administrator on 2023/8/2.
//


#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <unordered_map>
#include <unordered_set>
#include <queue>
#include <stack>
#include <cmath>

using namespace std;

class Solution {
public:
    vector<int> findColumnWidth(vector<vector<int>> &grid) {
        vector<int> result;
        int m = grid.size(), n = grid[0].size();
        for (int j = 0; j < n; ++j) {
            int colMaxLen = 0;
            for (int i = 0; i < m; ++i) {
                colMaxLen = max(int(to_string(grid[i][j]).size()), colMaxLen);
            }
            result.push_back(colMaxLen);
        }
        return result;
    }
};


int main() {
    Solution solution;
    vector<vector<int>> grid = {{-1, 1, 1, 1, 1},
                                {1,  1, 1, 1, 1},
                                {1,  1, 1, 1, 1},
                                {1,  1, 1, 1, 1},
                                {1,  1, 1, 1, 1}};
    vector<int> result = solution.findColumnWidth(grid);
    for (int i = 0; i < result.size(); i++) {
        cout << result[i] << endl;
    }
    return 0;
}


